package com.scuthnweb.action.authority;

import java.io.IOException;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.scuthnweb.tool.ValidateCode;
import com.scuthnweb.tool.ValidateCodeFileUtil;

public class UpdateVlidate_codeAction extends ActionSupport{
	
	private String vc_img_url;
	
	public String execute(){
		ActionContext ctx = ActionContext.getContext();
		String old_vc_img_url = (String)ctx.getSession().get("validate_code_url");
		ValidateCode vcd = null;
		try {
			vcd = ValidateCodeFileUtil.updateVC(old_vc_img_url, 120, 30, 4, 120);
		} catch (IOException e) {
			e.printStackTrace();
		}
		ctx.getSession().put("validate_code", vcd.getCode());
		ctx.getSession().put("validate_code_url", ValidateCodeFileUtil.parseUrl(vcd.getFileName()));
		this.vc_img_url = ValidateCodeFileUtil.parseUrl(vcd.getFileName());
		return SUCCESS;
	}
	
	public String getVc_img_url() {
		return vc_img_url;
	}

	public void setVc_img_url(String vc_img_url) {
		this.vc_img_url = vc_img_url;
	}
	
	
}
